<?php
	/**
	 * 获取公告
	 */
    class Announcement extends APIBase {
		
		public $tag = "Announcement";
    	public $isLogin = false;
		
		public function before() {
			$this->initCacheRedis();
			return true;
		}
		
		public function logic() {
			
			//$ann = $this->cache_redis->hMGet("ha:*", array("id","title","content","image_url"));
			$anns = $this->cache_redis->keys("ha:*");
			
			
			$count = count($anns);
			$result = array();
			if ($count) {
				for($i=0;$i<$count;$i++){
					
				  $result[] = $this->cache_redis->hGetAll("$anns[$i]");
				}

				$this->returnData($result);
			} else {
				$this->returnError(301,"对不起，暂无公告！");
			}

		}
		
        public function after() {
			$this->deinitCacheRedis();
		}
    }
?>
